var mySwiper = new Swiper('.swiper', {
    autoplay: true, //可选选项，自动滑动
    loop: true, //循环
    pagination: {
        el: '.swiper-pagination', //分页器
        clickable: true, //点击分页器
    },

    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    }, //左右切换
})
//跑马灯
let api = document.querySelectorAll('.api-bottom li')
let apiImg = document.querySelectorAll('.api-bottom li img')
let imgSrc = '';
api.forEach(function (dom, i) {
    dom.addEventListener('mouseover', function () {
        // console.log(apiImg[i])
        let pos1 = apiImg[i].src.lastIndexOf('/')
        let pos2 = apiImg[i].src.lastIndexOf('.')
        imgSrc = apiImg[i].src.substring(pos1+1,pos2)
        apiImg[i].src = `../imgs/${imgSrc}-c.svg`
        this.style.backgroundColor = 'rgb(47,126,233)'
        this.querySelector('p').style.color = '#fff'
        


    })
    dom.addEventListener('mouseout', function () {
        this.style.backgroundColor = '#fff'
        // console.log(apiImg[i])
        apiImg[i].src = `../imgs/${imgSrc}.svg`
        this.querySelector('p').style.color = '#000'
    })
})

// 助力企业自动循环播放
let helpItem = document.querySelectorAll('.help-item')
// console.log(helpItem)
let index = 0;//保存激活的索引
// 需求循环播放
let setTime = setInterval(foo,2000)
function foo() {
    helpItem[index].classList.remove('active')
    ++index;
    if(index === helpItem.length) index = 0;
    helpItem[index].classList.add('active')
    
}
//鼠标放上去停止播放
let busHelpContent = document.querySelector('.busHelp-content')
busHelpContent.addEventListener('mouseover', function(){
    clearInterval(setTime)
})
//移出启动
busHelpContent.addEventListener('mouseout', function(){
    setTime = setInterval(foo,2000)
})




